using System;
using System.Collections.Generic;
using UMC.Data;
namespace UMC.ITME.Entities
{
    public partial class Device
    {
        readonly static Action<Device, object>[] _SetValues = new Action<Device, object>[] { (r, t) => r.Caption = Reflection.ParseObject(t, r.Caption), (r, t) => r.CreatedTime = Reflection.ParseObject(t, r.CreatedTime), (r, t) => r.Desc = Reflection.ParseObject(t, r.Desc), (r, t) => r.Id = Reflection.ParseObject(t, r.Id), (r, t) => r.Ip = Reflection.ParseObject(t, r.Ip), (r, t) => r.Port = Reflection.ParseObject(t, r.Port), (r, t) => r.Username = Reflection.ParseObject(t, r.Username) };
        readonly static string[] _Columns = new string[] { "Caption", "CreatedTime", "Desc", "Id", "Ip", "Port", "Username" };
        protected override void SetValue(string name, object obv)
        {
            var index = Utility.Search(_Columns, name, StringComparer.CurrentCultureIgnoreCase);
            if (index > -1) _SetValues[index](this, obv);
        }
        protected override void GetValues(Action<String, object> action)
        {
            AppendValue(action, "Caption", this.Caption);
            AppendValue(action, "CreatedTime", this.CreatedTime);
            AppendValue(action, "Desc", this.Desc);
            AppendValue(action, "Id", this.Id);
            AppendValue(action, "Ip", this.Ip);
            AppendValue(action, "Port", this.Port);
            AppendValue(action, "Username", this.Username);
        }

        protected override RecordColumn[] GetColumns()
        {
            var cols = new RecordColumn[7];
            cols[0] = RecordColumn.Column("Caption", this.Caption);
            cols[1] = RecordColumn.Column("CreatedTime", this.CreatedTime);
            cols[2] = RecordColumn.Column("Desc", this.Desc);
            cols[3] = RecordColumn.Column("Id", this.Id);
            cols[4] = RecordColumn.Column("Ip", this.Ip);
            cols[5] = RecordColumn.Column("Port", this.Port);
            cols[6] = RecordColumn.Column("Username", this.Username);
            return cols;
        }

    }
}

